<?php
/*
 *TestGuest Version 1.0
 *Author:easterCat
 *Web:(www.jiangpeng.pub)
 *Date:2016-12-4
 */
header('Content-type:text/html;charset=utf-8');
date_default_timezone_set('PRC');
//关闭错误提示解决
ini_set('display_errors', 'off');
error_reporting(0);
$showapi_appid = '32069';
//app的密钥，值$signapi_sign
$showapi_secret = 'eef8940292184d47bf785df2d7f20510';
//动漫壁纸dmbz,人物壁纸rwbz,壁纸bz,比基尼美女bijini,制服美女zhifu,写真艺术nvyou,性格美女xingge,美女车展rufang,美女头像meitun,QQ头像qqtx,微信头像wxtx,女演员av,美女性感图片xinggan,模特美女mote,丝袜美女siwa,裙装美女qunzhuang,美女图片meinv,情趣美女qingqu,美食图片meishi,纹身图片wenshen,动物图片dongwu,影视剧照yingshi,自拍艺术tpzp
$post_type = $_GET['param'];
//$type = 'siwa';
$showapi_timestamp = str_replace(array("-", " ", ":"), "", date('Y-m-d H:i:s', time()));
$paramArr = array('showapi_appid' => $showapi_appid, 'id' => "");
$param = createParam($paramArr, $showapi_secret);
$url = 'http://route.showapi.com/959-1?' . '&showapi_appid=' . $showapi_appid . '&showapi_timestamp=' . $showapi_timestamp . '&type=' . $post_type . '&showapi_sign=' . $showapi_secret;

//echo '当前的url地址是' . $url;

$content = linkUrl($url);

if (!$content) {
    echo 'link error';
}
$result = json_decode($content, true);
$data = json_encode($result);
print_r($data);
return $data;

function linkUrl($url)
{
    $need_url = $url;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $need_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($ch, CURLOPT_POST, true);
    //var_dump(curl_error($ch));
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

    $response = curl_exec($ch);

    //var_dump($response);
    if ($response === FALSE) {
        echo 'URL ERROR : ' . curl_error($ch);
        return false;
    }

    curl_close($ch);
    return $response;
}

function createParam($paramAarr, $showapi_secret)
{
    $paraStr = '';
    $signStr = '';
    ksort($paramArr);
    foreach ($paramArr as $key => $val) {
        if ($key != '' && $val != '') {
            $signStr .= $key . $val;
            $paraStr .= $key . '=' . urlencode($val) . '&';
        }
    }
    $signStr .= $showapi_secret;
    //排好序的参数加上secret,进行md5
    $sign = strtolower(md5($signstr));
    //将md5后的值作为参数,便于服务器的效验
    $paraStr .= 'showapi_sign=' . $sign;
    return $paraStr;
}

function delStr()
{

}

?>